//父类
class Person{
	constructor(name,age){
		this.name = name
		this.age = age
	}
	eat(){
		console.log(`${ this.name } eat something`)
	}
	speak(){
		console.log(this.name +"speak,my age is" + this.age)
	}
	getName(){
		return this.name
	}
}

class Student extends Person{
	constructor(name,age,number){
		super(name,age)      //对父类的需要写在最上面
		this.number = number
	}
	study(){
		console.log(`${this.name}的学号是${this.number} `)
	}
	hello(){
		console.log(`${this.name}说helloworld`)
	}
	hello2(){
		console.log(`再次提交`)
	}
}
let p =new Person("xhh",24)
p.eat()
p.speak()

let s= new Student("xhh",24,58148)
s.study()
s.eat()
s.hello()
s.hello2()
// 类的三要素
// 继承，子类继承父类
// 封装，数据的权限和保密
// 多态，同一接口不同实现

import testjquery from './testjquery.js'
let $p = $('p')
console.log($p)

import UML from './uml类图.js'
import promisetest from './promise演示.js'
import cartrip from './车辆行程问题.js'

import creatorall from './工厂模式/factory.js'
//以函数的方式调用
let p1 = creatorall.creator("p1")
p1.init()
p1.fun1()

//另一种调用,以类的方式调用
var Creator = new creatorall.Creator()
var p2 = Creator.create("p2")
p2.init()
p2.fun1()

//单例模式，待完成

import single from './单例模式/single.js'
import singlelogin from './单例模式/模拟登陆.js'

let singleloginmodal1 = singlelogin.login.getInstance()
singleloginmodal1.show()

let singleloginmodal2 = singlelogin.login.getInstance()
singleloginmodal2.show()


//适配器模式
import adaptee from './适配器模式/adaprer.js'
let targetor = new adaptee.Target()
let info = targetor.request()
console.log(info)

//装饰器模式
import decorator from './装饰器模式/decorator'
let circle = new decorator.circle()
circle.draw()

//带上装饰器:
let redcircle = new decorator.decorator(circle)
redcircle.draw()


import decdemo from './装饰器模式/使用@符号'
import supreperdon from './装饰器模式/使用库的装饰器'

//代理模式
import proxy from './代理模式/proctest1.js'
let proxyimg = new proxy.ProxyImg("1.jpg")
proxyimg.display()

import proxyagent from './代理模式/经纪人模式.js'
//观察者模式

import observer from './观察者模式/发布订阅.js'